<?php
error_reporting(0);
session_start();
include_once '../comm/config.php';
include_once '../comm/checkpostandget.php';
include_once 'check.php';
include_once '../comm/wjt.php';

$id=(int)$_GET["id"]; 
if($id==0){
    exit(ERR404);
}

$sql="select * from ".$BIAOTOU."tradelist where id='".$id."'";
$rs = mysql_query($sql);
while($row = mysql_fetch_object($rs)) {
	$tbjyh=$row->trade_id; 
	$th="";
	for($len=strlen($tbjyh)-3;$len>0;$len=$len-1){
		$th=$th."*";
	}
	$tbjyh=substr($tbjyh,0,1)."".$th."".substr($tbjyh,strlen($tbjyh)-1,1);
	$jysj=$row->pay_time; 
	$spmc=$row->item_title; 
	$dj=$row->pay_price; 
	$seller_nick=$row->seller_nick; 
	$cjsl=$row->item_num; 
	$fxje=ck_fxje($row->commission,$_SESSION["dduserlevel"]);
}

$tag="center";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>找回订单 - 用户中心</title>
<link href="../css/usercss.css" rel="stylesheet" type="text/css">
<link href="../template/<?=MOBAN?>/css/common.css" rel="stylesheet" type="text/css">
<style type="text/css">
#newPreview
{
    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
}
</style>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript"> 
picSuffix=new Array('gif','jpg');
function valida(sFilePath){
        var rgx=/(jpg|gif|png|jpeg)/i;
        var ext=sFilePath.substring(sFilePath.lastIndexOf(".")+1);
        if(!rgx.test(ext)){
			return 0;
		}
		else{
		    return 1;
		}
    }
function PreviewImg()
{   
    var imgFile=document.getElementById("up_pic");
	if(imgFile.value==''){
		document.getElementById("ckup_pic").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请上传订单截图：</font>';
	    return false;
	}
	else if(valida(imgFile.value)==0){
		document.getElementById("ckup_pic").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>只允许上传gif | jpg | png格式的文件：</font>';
		return false;
	}
	else{
	    var newPreview = document.getElementById("newPreview");
        newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value;
        newPreview.style.width = "348px";
        newPreview.style.height = "79px";
		document.getElementById("ckup_pic").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle />';
		return true;
	}
    
}

function checkjyh()
{
		var str1 = document.getElementById("jyh").value;    
        if(str1.length!=0)
		{     
				document.getElementById("ckjyh").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle />';
				return true;
		}
		else
		{
				document.getElementById("ckjyh").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请填写订单号：</font>';
				return false;
		}
} 
function checkyzm()
{
		var str1 = document.getElementById("yzm").value;    
        if(str1.length==4)
		{     
				document.getElementById("ckyzm").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle />';
				return true;
		}
		else
		{
				document.getElementById("ckyzm").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>验证码错误：</font>';
				return false;
		}
}   
function checkall()
{
	if(!checkjyh()||!checkyzm()||!PreviewImg())
	{
		return false;
	}
	else
	{
		return true;
	}
}
</script>
</head>

<body id="tradelist">
<?php
include("../template/".MOBAN."/header.tpl.php");
?>
<?php
include("../template/".MOBAN."/nav.tpl.php");
?>
<div id="main">
<?php
include("left.php");
?>
<div class="contain">
  <h2 class="left_nav2">找回订单(淘宝)</h2>
    <div class="order">
    <div class="content" style="font-size:12px; height:300px;">
<form id="form2" name="form2" method="post" action="queren_save.php" onsubmit="return checkall()"  enctype="multipart/form-data">
                        <table width="680" border="0" cellspacing="0" cellpadding="0" >
                          <tr>
                            <td width="680" height="38" align="left"><div style="border:1px solid #FFCC7F; background-color:#FFFFE5; padding:8px;">注：如果您发现系统没有自动返现给您，可能是您购买商品的时候未登录，请输入淘宝交易号进行确认，只要您输入的淘宝交易号与系统内的一致，这笔交易您就确认成功了。</div></td>
                          </tr>
          </table>
                        <table width="680" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td width="121" height="35" align="right">商品名称：</td>
                          <td height="35" colspan="2" align="left">&nbsp;<font color="#dd0000"><?php echo $spmc;?></font>
                          <input type="hidden" name="id" value="<?php echo $id;?>" /></td>
                        </tr>
						 
                        <tr>
                          <td height="35" align="right">淘宝交易号：</td>
                          <td height="35" align="left">&nbsp;<font color="#dd0000"><?php echo $tbjyh;?></font></td>
                          <td width="350" rowspan="5" align="left">
                          <div id="newPreview" style=" width:348px; height:79px; background:url(../upload/ddjt.jpg); border:#CCC 1px solid"></div>
                          <p><em style="font-style:normal;" id="ckup_pic"></em><input id="up_pic" name="up_pic" type="file" style="width:236px" onchange="javascript:PreviewImg();" /></p>
                          </td>
                        </tr>
                        <tr>
                          <td height="35" align="right">单&nbsp;&nbsp;价：</td>
                          <td height="35" align="left">&nbsp;<font color="#dd0000"><?php echo $dj;?> ( 成交数量：<?php echo $cjsl;?> )</font></td>
                          </tr>
                        <tr>
                          <td height="35" align="right">返现金额：</td>
                          <td height="35" align="left">&nbsp;<font color="#dd0000"><?php echo $fxje;?></font></td>
                          </tr>
                        <tr>
                          <td height="35" align="right" id="ckjyh">输入淘宝交易号：</td>
                          <td width="239" height="35" align="left">
                          <input name="jyh" type="text" id="jyh" maxlength="20" onblur="checkjyh();" /></td>
                          </tr>
                        <tr>
                          <td height="35" align="right" id="ckyzm">验证码：</td>
                          <td height="35" align="left"><input name="yzm" type="text" size="10" maxlength="4"  onblur="checkyzm();" />
                          <img src="../comm/yzm.php" align="absmiddle" border="0" /></td>
                          </tr>
                        <tr>
                          <td height="35" align="right">&nbsp;</td>
                          <td height="35" colspan="2" align="left"><input type="submit" name="Submit2" value="找回订单" class="smtgray" /></td>
                        </tr>
          </table>
          <input name="vp" type="hidden" id="vp" value="1">
        </form>
					  </div>
	</div>
</div>
</div>
<?php
include("../template/".MOBAN."/footer.tpl.php");
?>
</body>
</html>